<template>
	<view>
		<uni-nav-bar dark :fixed="true" shadow background-color="#007AFF"
			status-bar left-icon="left" left-text="返回"
			title="我的订单" @clickLeft="back" />
			
		<uni-list>
			<!-- 显示圆形头像 -->
			<uni-card v-for="order in myOrderList"
			 sub-title="" :extra="order.deliveryAddress"
				@click="pay(order.id,order.totalAmount)">
				<view><text class="uni-body">{{order.id}}</text></view>
				<view><text class="uni-body">总金额：{{order.totalAmount}}</text></text></view>
				<view><text class="uni-body">订单状态：{{order.orderStatus}}</text></text></view>
				
			</uni-card>
			
		</uni-list>
	</view>
</template>

<script>
import orderApi from '../../api/order/order.js'
export default {
	components: {},
	data() {
		return {
			myOrderList:[],
			pageNo:1,
			pageSize:20,
			total:0
		}
	},
	methods:{
		back() {
			uni.navigateBack({
				delta: 1
			})
		},
		getMyOrderList(){
			
			orderApi.myOrderList(this.pageNo,this.pageSize).then(res=>{
				if(res.ok){
					this.myOrderList = res.data.records;
					this.total = res.data.total;
				}
			})
		},
		pay(orderId,amount){
			console.log('===================')
			uni.navigateTo({
				url:"/gmall/views/pay/wxPay?orderId=" + orderId + "&amount=1" ,
			})
		}
	},		
	onLoad(options) {
		
		this.getMyOrderList();
		
	}
}
</script>

<style>
</style>